package io.github.neo.hhcache.command.zset;

import io.github.neo.hhcache.core.Command;
import io.github.neo.hhcache.core.HHCache;
import io.github.neo.hhcache.entry.Reply;

/**
 * @author: hhz
 * @create: 2024/7/10
 **/
public class ZcountCommand implements Command {
    @Override
    public String name() {
        return "ZCOUNT";
    }

    @Override
    public Reply<?> exec(HHCache cache, String[] args) {
        String key = getKey(args);
        // 元素
       double min = Double.parseDouble(getVal(args));
       double max = Double.parseDouble(args[8]);
        return Reply.integer(cache.zcount(key, min, max));
    }
}
